package com.huang;

import java.util.Comparator;
import java.util.Iterator;
import java.util.TreeSet;

/**
 * @author HuangShen
 * @Description
 * @create 2021-03-23 7:47
 */
public class TestMain {

    public static void main(String[] args) {
        TreeSet<Stu> stus = new TreeSet<>();
        stus.add(new Stu("hh1", 15));
        stus.add(new Stu("hh1", 14));
        stus.add(new Stu("hh3", 15));
        stus.add(new Stu("hh4", 15));

        Iterator<Stu> iterator = stus.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        iterator = stus.iterator();
        while (iterator.hasNext()){
            if (iterator.next().getName().equals("hh4")){
                iterator.remove();
            }
        }


    }
}
